
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>5、MISC · turf源码算法分析</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="lijian">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="chapter6.html" />
    
    
    <link rel="prev" href="chapter4.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    INTRODUCE
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="chapter1.html">
            
                <a href="chapter1.html">
            
                    
                    1、MEASUREMENT
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="chapter2.html">
            
                <a href="chapter2.html">
            
                    
                    2、COORDINATE MUTATION
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="chapter3.html">
            
                <a href="chapter3.html">
            
                    
                    3、TRANSFORMATION
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="chapter4.html">
            
                <a href="chapter4.html">
            
                    
                    4、FEATURE CONVERSION
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.6" data-path="chapter5.html">
            
                <a href="chapter5.html">
            
                    
                    5、MISC
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="chapter6.html">
            
                <a href="chapter6.html">
            
                    
                    6、HELPER
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="chapter7.html">
            
                <a href="chapter7.html">
            
                    
                    7、RANDOM
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="chapter8.html">
            
                <a href="chapter8.html">
            
                    
                    8、DATA
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="chapter9.html">
            
                <a href="chapter9.html">
            
                    
                    9、INTERPOLATION
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="chapter10.html">
            
                <a href="chapter10.html">
            
                    
                    10、JOINS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="chapter11.html">
            
                <a href="chapter11.html">
            
                    
                    11、GRIDS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="chapter12.html">
            
                <a href="chapter12.html">
            
                    
                    12、CLASSIFICATION
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="chapter13.html">
            
                <a href="chapter13.html">
            
                    
                    13、AGGREGATION
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="chapter14.html">
            
                <a href="chapter14.html">
            
                    
                    14、META
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16" data-path="chapter15.md">
            
                <span>
            
                    
                    15、ASSERTIONS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17" data-path="chapter16.html">
            
                <a href="chapter16.html">
            
                    
                    16、BOOLEANS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18" data-path="chapter17.md">
            
                <span>
            
                    
                    17、UNIT CONVERSION
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >5、MISC</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="kinks">kinks</h1>
<blockquote>
<p>&#x83B7;&#x53D6;&#x6298;&#x7EBF;&#x6216;&#x8005;&#x591A;&#x8FB9;&#x5F62;&#x81EA;&#x4EA4;&#x8282;&#x70B9;&#x7EC4;&#x5408;&#xFF0C;&#x672C;&#x8D28;&#x4E3A;&#x6C42;&#x7EBF;&#x6BB5;AB&#x548C;&#x7EBF;&#x6BB5;CD&#x7684;&#x4EA4;&#x70B9;&#x5750;&#x6807;&#x3002;&#x7B97;&#x6CD5;&#x6D89;&#x53CA;1)&#x884C;&#x5217;&#x5F0F;&#x6C42;&#x89E3;&#x65B9;&#x7A0B;&#x5F0F;&#xFF0C;2)&#x884C;&#x5217;&#x5F0F;&#x6C42;&#x89E3;&#x4E24;&#x6761;&#x7EBF;&#x6BB5;&#x4EA4;&#x70B9;3)&#x5224;&#x65AD;&#x70B9;&#x5728;&#x7EBF;&#x6BB5;&#xFF0C;&#x4E0D;&#x53CA;&#x6DF1;&#x7A76;&#xFF0C;&#x4EC5;&#x63D0;&#x4F9B;&#x4E24;&#x4E2A;&#x7B97;&#x6CD5;&#x53C2;&#x8003;&#x3002;</p>
</blockquote>
<p><a href="https://ccjou.wordpress.com/2014/03/05/%E5%88%A9%E7%94%A8%E8%A1%8C%E5%88%97%E5%BC%8F%E6%B1%82%E7%9B%B4%E7%B7%9A%E3%80%81%E5%B9%B3%E9%9D%A2%E5%92%8C%E5%9C%93%E6%96%B9%E7%A8%8B%E5%BC%8F/" target="_blank">&#x884C;&#x5217;&#x5F0F;&#x6C42;&#x89E3;&#x65B9;&#x7A0B;&#x5F0F;</a></p>
<p><a href="https://www.cnblogs.com/xpvincent/p/5208994.html" target="_blank">&#x884C;&#x5217;&#x5F0F;&#x6C42;&#x89E3;&#x4E24;&#x6761;&#x76F4;&#x7EBF;&#x7684;&#x4EA4;&#x70B9;</a></p>
<p><a href="https://www.itdaan.com/tw/3391224e3d934aedcabe24c8f851adc1" target="_blank">&#x5224;&#x65AD;&#x70B9;&#x5728;&#x7EBF;&#x6BB5;&#x4E0A;</a></p>
<p>&#x76F4;&#x7EBF;L1&#xFF1A;ax + by = e</p>
<p>&#x76F4;&#x7EBF;L2&#xFF1A;cx + dy = f</p>
<p>&#x5219;&#x4EA4;&#x70B9;P(m, n)</p>
<p>&#x200B;    m = (de - bf) / (ad - bc)</p>
<p>&#x200B;    n = (af - ce) / (ad -bc)</p>
<h1 id="linearc">lineArc</h1>
<blockquote>
<p>&#x7ED9;&#x5B9A;&#x5706;&#x5F62;O, &#x534A;&#x5F84;R&#xFF0C;&#x8D77;&#x70B9;&#x89D2;&#x5EA6;A1&#xFF0C;&#x7EC8;&#x70B9;&#x89D2;&#x5EA6;A2&#xFF0C;&#x751F;&#x6210;&#x7EC4;&#x6210;&#x5706;&#x5F27;&#x7684;&#x6298;&#x7EBF;&#x6BB5;L</p>
</blockquote>
<p><strong>&#x601D;&#x8DEF;&#xFF1A;</strong></p>
<ol>
<li>&#x7ED9;&#x5B9A;&#x5706;&#x5FC3;&#x548C;&#x534A;&#x5F84;&#xFF0C;&#x53EF;&#x4EE5;&#x6C42;&#x51FA;&#x8BE5;&#x5706;&#x4E0A;&#x6240;&#x6709;&#x7684;&#x70B9;(&#x91C7;&#x7528;destination&#x7B97;&#x6CD5;)&#xFF0C;&#x53D6;&#x51FA;&#x4F4D;&#x4E8E;&#x8D77;&#x70B9;&#x89D2;&#x5EA6;A1&#x548C;&#x7EC8;&#x70B9;&#x89D2;&#x5EA6;A2&#x4E4B;&#x95F4;&#x7684;&#x70B9;&#x5373;&#x53EF;</li>
</ol>
<p><strong>&#x5B9E;&#x73B0;&#xFF1A;</strong></p>
<pre><code class="lang-javascript"><span class="hljs-comment">/**
 * @name lineArc
 * @param {Coord} center &#x5706;&#x5FC3;O
 * @param {number} radius &#x534A;&#x5F84;R
 * @param {number} bearing1 &#x8D77;&#x70B9;&#x89D2;&#x5EA6;A1
 * @param {number} bearing2 &#x7EC8;&#x70B9;&#x89D2;&#x5EA6;A2
 * @param {Object} [options={}] &#x989D;&#x5916;&#x7684;&#x5C5E;&#x6027;
 * @param {number} [options.steps=64] &#x7CBE;&#x7EC6;&#x5EA6;
 * @param {string} [options.units=&apos;kilometers&apos;] &#x5355;&#x4F4D;
 */</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">lineArc</span>(<span class="hljs-params">center: Coord, radius: number, bearing1: number, bearing2: number, options: {
    steps?: number,
    units?: Units,
} = {}</span>): <span class="hljs-title">Feature</span>&lt;<span class="hljs-title">LineString</span>&gt; </span>{
    <span class="hljs-comment">// &#x9ED8;&#x8BA4;&#x6298;&#x7EBF;&#x7684;&#x6570;&#x76EE;&#x662F;64</span>
    <span class="hljs-keyword">const</span> steps = options.steps || <span class="hljs-number">64</span>;

    <span class="hljs-comment">// &#x5F27;&#x5EA6;&#x8F6C;&#x89D2;&#x5EA6;</span>
    <span class="hljs-keyword">const</span> angle1 = convertAngleTo360(bearing1);
    <span class="hljs-keyword">const</span> angle2 = convertAngleTo360(bearing2);
    <span class="hljs-keyword">const</span> properties = (!<span class="hljs-built_in">Array</span>.isArray(center) &amp;&amp; center.type === <span class="hljs-string">&quot;Feature&quot;</span>)  ? center.properties : {};

    <span class="hljs-comment">// &#x521D;&#x59CB;&#x89D2;&#x5EA6;A1&#x4E0E;&#x7ED3;&#x675F;&#x89D2;&#x5EA6;A2&#x76F8;&#x7B49;&#xFF0C;&#x5219;&#x8FD4;&#x56DE;&#x5706;&#x5F62;</span>
    <span class="hljs-keyword">if</span> (angle1 === angle2) {
        <span class="hljs-keyword">return</span> lineString(circle(center, radius, options).geometry.coordinates[<span class="hljs-number">0</span>], properties);
    }
    <span class="hljs-keyword">const</span> arcStartDegree = angle1;
    <span class="hljs-keyword">const</span> arcEndDegree = (angle1 &lt; angle2) ? angle2 : angle2 + <span class="hljs-number">360</span>;

    <span class="hljs-keyword">let</span> alfa = arcStartDegree;
    <span class="hljs-keyword">const</span> coordinates = [];
    <span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>;

    <span class="hljs-comment">// &#x5F00;&#x59CB;&#x89D2;&#x5EA6;&#x9012;&#x589E;&#xFF0C;&#x5B58;&#x50A8;&#x6EE1;&#x8DB3;&#x6761;&#x4EF6;&#x7684;&#x8282;&#x70B9;</span>
    <span class="hljs-keyword">while</span> (alfa &lt; arcEndDegree) {
        coordinates.push(destination(center, radius, alfa, options).geometry.coordinates);
        i++;
        alfa = arcStartDegree + i * <span class="hljs-number">360</span> / steps;
    }
    <span class="hljs-keyword">if</span> (alfa &gt; arcEndDegree) {
        coordinates.push(destination(center, radius, arcEndDegree, options).geometry.coordinates);
    }

    <span class="hljs-comment">// &#x5C06;&#x7ED3;&#x679C;&#x6570;&#x7EC4;&#x8F6C;&#x4E3A;&#x6298;&#x7EBF;&#x6BB5;L</span>
    <span class="hljs-keyword">return</span> lineString(coordinates, properties);
}
</code></pre>
<h1 id="linechunk">lineChunk</h1>
<blockquote>
<p>&#x5C06;&#x6298;&#x7EBF;&#x6BB5;L&#x62C6;&#x5206;&#x4E3A;&#x957F;&#x5EA6;&#x4E3A;m(m&#x4E00;&#x822C;&#x8FDC;&#x5C0F;&#x4E8E;L&#x7684;&#x957F;&#x5EA6;)&#x7684;&#x8BB8;&#x591A;&#x5C0F;&#x7684;&#x6298;&#x7EBF;&#x6BB5;</p>
</blockquote>
<p><strong>&#x601D;&#x8DEF;&#xFF1A;</strong></p>
<ol>
<li>&#x6839;&#x636E;&#x7EBF;&#x6BB5;L&#x7684;&#x957F;&#x5EA6;&#x548C;&#x5C0F;&#x6298;&#x7EBF;&#x6BB5;&#x7684;&#x957F;m&#x83B7;&#x53D6;&#x6298;&#x7EBF;&#x6BB5;&#x7684;&#x6570;&#x76EE;</li>
<li>&#x91C7;&#x7528;lineSliceAlong&#x7B97;&#x6CD5;&#x5C06;&#x5404;&#x4E2A;&#x5C0F;&#x6298;&#x7EBF;&#x6BB5;&#x5B58;&#x5165;&#x6570;&#x7EC4;&#x4E2D;</li>
<li>&#x5C06;&#x7ED3;&#x679C;&#x6570;&#x7EC4;&#x7EC4;&#x5408;&#x6210;featureCollection</li>
</ol>
<p><strong>&#x5B9E;&#x73B0;&#xFF1A;</strong></p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> chunk = []; <span class="hljs-comment">// &#x7ED3;&#x679C;&#x6570;&#x7EC4;</span>
<span class="hljs-comment">// &#x83B7;&#x53D6;&#x7EBF;&#x6BB5;L&#x7684;&#x957F;&#x5EA6;</span>
<span class="hljs-keyword">var</span> lineLength = length(line, {units: units});

<span class="hljs-keyword">if</span> (lineLength &lt;= segmentLength) <span class="hljs-keyword">return</span>;

<span class="hljs-comment">// &#x5C06;&#x8981;&#x88C1;&#x6210;&#x5C0F;&#x7EBF;&#x6BB5;&#x7684;&#x6570;&#x76EE;</span>
<span class="hljs-keyword">var</span> numberOfSegments = lineLength / segmentLength;
<span class="hljs-keyword">if</span> (!<span class="hljs-built_in">Number</span>.isInteger(numberOfSegments)) {
    numberOfSegments = <span class="hljs-built_in">Math</span>.floor(numberOfSegments) + <span class="hljs-number">1</span>;
}

<span class="hljs-comment">// &#x5FAA;&#x73AF;&#x83B7;&#x53D6;&#x5C0F;&#x7EBF;&#x6BB5;</span>
<span class="hljs-keyword">for</span> (<span class="hljs-keyword">var</span> i = <span class="hljs-number">0</span>; i &lt; numberOfSegments; i++) {
    <span class="hljs-keyword">var</span> outline = lineSliceAlong(line, segmentLength * i, segmentLength * (i + <span class="hljs-number">1</span>), {units: units});
    chunk.push(outline);
}
<span class="hljs-keyword">return</span> featureCollection(chunk)
</code></pre>
<h1 id="lineintersect">lineIntersect</h1>
<blockquote>
<p>&#x8FD4;&#x56DE;&#x6298;&#x7EBF;&#x6298;&#x7EBF;&#x6216;&#x6298;&#x7EBF;&#x591A;&#x8FB9;&#x5F62;&#x6216;&#x591A;&#x8FB9;&#x5F62;&#x591A;&#x8FB9;&#x5F62;&#x7684;&#x51E0;&#x4F55;&#x4EA4;&#x70B9;&#x3002;&#x591A;&#x8FB9;&#x5F62;&#x548C;&#x6298;&#x7EBF;&#x90FD;&#x662F;&#x7531;&#x7EBF;&#x6BB5;&#x7EC4;&#x6210;&#xFF0C;&#x8FD9;&#x91CC;&#x7ED9;&#x51FA;&#x7EBF;&#x6BB5;&#x4EA4;&#x70B9;&#x7684;&#x7B97;&#x6CD5;&#x3002;</p>
</blockquote>
<p><strong>&#x5B9E;&#x73B0;:</strong></p>
<p><img src="../Image/interestLine.png" alt=""></p>
<pre><code class="lang-javascript"><span class="hljs-comment">// AB&#x5411;&#x91CF;&#x4E0E;CD&#x5411;&#x91CF;&#x7684;&#x53C9;&#x79EF;</span>
<span class="hljs-keyword">const</span> denom = ((y4 - y3) * (x2 - x1)) - ((x4 - x3) * (y2 - y1));
<span class="hljs-comment">// CA&#x5411;&#x91CF;&#x4E0E;CD&#x5411;&#x91CF;&#x7684;&#x53C9;&#x79EF;</span>
<span class="hljs-keyword">const</span> numeA = ((x4 - x3) * (y1 - y3)) - ((y4 - y3) * (x1 - x3));
<span class="hljs-comment">// AB&#x5411;&#x91CF;&#x4E0E;AC&#x5411;&#x91CF;&#x7684;&#x53C9;&#x79EF;</span>
<span class="hljs-keyword">const</span> numeB = ((x2 - x1) * (y1 - y3)) - ((y2 - y1) * (x1 - x3));

<span class="hljs-keyword">const</span> uA = numeA / denom;
<span class="hljs-keyword">const</span> uB = numeB / denom;

<span class="hljs-comment">// &#x6EE1;&#x8DB3;&#x6761;&#x4EF6;&#x5219;&#x4E24;&#x6761;&#x7EBF;&#x6BB5;&#x5B58;&#x5728;&#x4EA4;&#x70B9;</span>
<span class="hljs-keyword">if</span> (uA &gt;= <span class="hljs-number">0</span> &amp;&amp; uA &lt;= <span class="hljs-number">1</span> &amp;&amp; uB &gt;= <span class="hljs-number">0</span> &amp;&amp; uB &lt;= <span class="hljs-number">1</span>) {
    <span class="hljs-keyword">const</span> x = x1 + (uA * (x2 - x1));
    <span class="hljs-keyword">const</span> y = y1 + (uA * (y2 - y1));
    <span class="hljs-keyword">return</span> point([x, y]);
}
</code></pre>
<p>&#x4E0A;&#x9762;&#x7684;&#x7B97;&#x6CD5;&#x5176;&#x5B9E;&#x4E0D;&#x662F;&#x5F88;&#x660E;&#x767D;&#xFF0C;&#x5982;&#x6709;&#x6E05;&#x695A;&#x8BF7;&#x544A;&#x77E5;&#xFF0C;&#x53CA;&#x65F6;&#x8865;&#x5145;&#x3002;</p>
<p>lineOverlap</p>
<h1 id="linesegment">lineSegment</h1>
<blockquote>
<p>&#x901A;&#x5E38;&#x662F;&#x5C06;&#x4E00;&#x6761;&#x6298;&#x7EBF;&#x53D8;&#x6210;&#x82E5;&#x5E72;&#x6761;&#x7EBF;&#x6BB5;</p>
</blockquote>
<p><strong>&#x601D;&#x8DEF;&#xFF1A;</strong></p>
<ol>
<li>&#x904D;&#x5386;&#x6298;&#x7EBF;&#xFF0C;&#x5C06;&#x5404;&#x4E2A;&#x7EBF;&#x6BB5;&#x5B58;&#x50A8;&#x5728;&#x7ED3;&#x679C;&#x6570;&#x7EC4;&#x4E2D;</li>
</ol>
<p><strong>&#x5B9E;&#x73B0;:</strong></p>
<pre><code class="lang-javascript"><span class="hljs-comment">// &#x7ED3;&#x679C;&#x6570;&#x7EC4;</span>
<span class="hljs-keyword">const</span> segments: <span class="hljs-built_in">Array</span>&lt;Feature&lt;LineString&gt;&gt; = [];

<span class="hljs-comment">// &#x904D;&#x5386;&#x6298;&#x7EBF;&#x5750;&#x6807;</span>
coords.reduce((previousCoords, currentCoords) =&gt; {
    <span class="hljs-comment">// &#x8FD9;&#x91CC;&#x4F1A;&#x5B58;&#x5728;&#x4E00;&#x6761;&#x9996;&#x5C3E;&#x5750;&#x6807;&#x76F8;&#x540C;&#x7684;&#x7EBF;&#x6BB5;&#xFF0C;&#x663E;&#x793A;&#x4E0D;&#x53D7;&#x5F71;&#x54CD;&#xFF0C;&#x5176;&#x5B9E;&#x53EF;&#x4EE5;&#x505A;&#x4E00;&#x4E2A;&#x5224;&#x65AD;&#x53BB;&#x9664;&#x8FD9;&#x4E2A;&#x5F71;&#x54CD;</span>
    <span class="hljs-keyword">const</span> segment = lineString([previousCoords, currentCoords], properties);
    segment.bbox = bbox(previousCoords, currentCoords);
    segments.push(segment);
    <span class="hljs-keyword">return</span> currentCoords;
});
<span class="hljs-keyword">return</span> segments
</code></pre>
<h1 id="lineslice">lineSlice</h1>
<blockquote>
<p>&#x83B7;&#x53D6;&#x7EBF;&#x6BB5;L&#x4E0A;&#x8DDD;&#x8F93;&#x5165;&#x7684;&#x4E24;&#x70B9;A, B&#x6700;&#x8FD1;&#x7684;&#x4E24;&#x70B9;A&apos;, B&apos;&#xFF08;&#x5982;&#x679C;A, B&#x5728;&#x7EBF;&#x6BB5;&#x4E0A;&#x5219;A, A&apos;&#x76F8;&#x7B49;&#xFF0C;B, B&#x2018; &#x76F8;&#x7B49;&#xFF09;&#x7EC4;&#x6210;&#x7684;&#x6298;&#x7EBF;&#x6BB5;A&apos;B&apos;</p>
</blockquote>
<p><strong>&#x601D;&#x8DEF;&#xFF1A;</strong></p>
<ol>
<li>&#x83B7;&#x53D6;A&apos;, B&apos;&#x5750;&#x6807;&#xFF0C;&#x91C7;&#x7528;&#x7B97;&#x6CD5; nearestPointOnLine</li>
<li>&#x904D;&#x5386;&#x7EBF;&#x6BB5;&#x5750;&#x6807;&#xFF0C;&#x5C06;&#x5E8F;&#x53F7;&#x4F4D;&#x4E8E;A&apos;, B&apos;&#x5E8F;&#x53F7;&#x4E4B;&#x95F4;&#x7684;&#x8282;&#x70B9;&#x5B58;&#x5165;&#x7ED3;&#x679C;&#x6570;&#x7EC4;</li>
<li>&#x5C06;&#x7ED3;&#x679C;&#x6570;&#x7EC4;&#x7EC4;&#x6210;&#x6298;&#x7EBF;&#x6BB5;</li>
</ol>
<p><strong>&#x5B9E;&#x73B0;&#xFF1A;</strong></p>
<pre><code class="lang-javascript"><span class="hljs-comment">/* 
 * @name lineSlice
 * @param {Coord} startPt A&#x5750;&#x6807;
 * @param {Coord} stopPt B&#x5750;&#x6807;
 * @param {Feature&lt;LineString&gt;|LineString} &#x7EBF;&#x6BB5;L
 * @returns {Feature&lt;LineString&gt;} &#x7ED3;&#x679C;&#x6298;&#x7EBF;A&apos;B&apos;
 */</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">lineSlice</span>(<span class="hljs-params">startPt, stopPt, line</span>) </span>{
    <span class="hljs-comment">// &#x83B7;&#x53D6;GeoJSON&#x4E2D;&#x7684;coordinates</span>
    <span class="hljs-keyword">var</span> coords = getCoords(line);
    <span class="hljs-keyword">if</span> (getType(line) !== <span class="hljs-string">&apos;LineString&apos;</span>) <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Error</span>(<span class="hljs-string">&apos;line must be a LineString&apos;</span>);

    <span class="hljs-comment">// &#x83B7;&#x53D6;A&apos;, B&apos;&#x8282;&#x70B9;&#xFF0C;&#x91C7;&#x7528;nearestPointOnLine&#x7B97;&#x6CD5;&#x5F97;&#x5230;&#x7684;&#x7ED3;&#x679C;&#x8282;&#x70B9;&#x4F1A;&#x4FDD;&#x5B58;&#x8BE5;&#x8282;&#x70B9;&#x5728;&#x7EBF;&#x6BB5;&#x5750;&#x6807;&#x4E2D;&#x7684;&#x5E8F;&#x53F7;index</span>
    <span class="hljs-keyword">var</span> startVertex = nearestPointOnLine(line, startPt);
    <span class="hljs-keyword">var</span> stopVertex = nearestPointOnLine(line, stopPt);
    <span class="hljs-keyword">var</span> ends;
    <span class="hljs-keyword">if</span> (startVertex.properties.index &lt;= stopVertex.properties.index) {
        ends = [startVertex, stopVertex];
    } <span class="hljs-keyword">else</span> {
        ends = [stopVertex, startVertex];
    }
    <span class="hljs-keyword">var</span> clipCoords = [ends[<span class="hljs-number">0</span>].geometry.coordinates];

    <span class="hljs-comment">// &#x83B7;&#x53D6;&#x7EBF;&#x6BB5;&#x4E0A;&#x4F4D;&#x4E8E;&#x9996;&#x672B;&#x8282;&#x70B9;&#x5750;&#x6807;&#x5E8F;&#x53F7;&#x4E4B;&#x95F4;&#x7684;&#x6240;&#x6709;&#x8282;&#x70B9;</span>
    <span class="hljs-keyword">for</span> (<span class="hljs-keyword">var</span> i = ends[<span class="hljs-number">0</span>].properties.index + <span class="hljs-number">1</span>; i &lt; ends[<span class="hljs-number">1</span>].properties.index + <span class="hljs-number">1</span>; i++) {
        clipCoords.push(coords[i]);
    }
    clipCoords.push(ends[<span class="hljs-number">1</span>].geometry.coordinates);
    <span class="hljs-keyword">return</span> linestring(clipCoords, line.properties);
}
</code></pre>
<h1 id="lineslicealong">lineSliceAlong</h1>
<blockquote>
<p>&#x6709;&#x70B9;&#x7C7B;&#x4F3C;lineSlice&#xFF0C;&#x8FD9;&#x91CC;&#x7ED9;&#x5B9A;&#x4E24;&#x4E2A;&#x8DDD;&#x79BB;L1, L2, &#x83B7;&#x53D6;&#x6298;&#x7EBF;&#x6BB5;L&#x4E0A;&#x4ECE;&#x8D77;&#x70B9;&#x7B97;&#x8D77;&#x8DDD;&#x79BB;&#x4E3A;L1&#xFF0C; L2&#x7684;&#x4E24;&#x4E2A;&#x70B9;A&#xFF0C; B&#x7EC4;&#x6210;&#x7684;&#x6298;&#x7EBF;&#x6BB5;AB</p>
</blockquote>
<p><strong>&#x601D;&#x8DEF;&#xFF1A;</strong></p>
<ol>
<li>&#x904D;&#x5386;&#x6298;&#x7EBF;&#x6BB5;L&#x8282;&#x70B9;&#xFF0C;&#x8BB0;&#x5F55;&#x904D;&#x5386;&#x8DDD;&#x79BB;&#xFF0C;&#x7ED3;&#x679C;&#x6570;&#x7EC4;&#x4F9D;&#x6B21;&#x5B58;&#x50A8;&#x904D;&#x5386;&#x7684;&#x8DDD;&#x79BB;&#x4F4D;&#x4E8E;L1&#xFF0C; L2&#x4E4B;&#x95F4;&#x7684;&#x8282;&#x70B9;&#x5750;&#x6807;</li>
<li>&#x5C06;&#x7ED3;&#x679C;&#x6570;&#x7EC4;&#x8F6C;&#x6210;&#x6298;&#x7EBF;&#x6BB5;AB</li>
</ol>
<p><strong>&#x5B9E;&#x73B0;&#xFF1A;</strong></p>
<pre><code class="lang-javascript"><span class="hljs-comment">/**
 * @name lineSliceAlong
 * @param {Feature&lt;LineString&gt;|LineString} &#x7EBF;&#x6BB5;L
 * @param {number} startDist &#x5F00;&#x59CB;&#x8DDD;&#x79BB;L1
 * @param {number} stopDist &#x7ED3;&#x675F;&#x8DDD;&#x79BB;L2
 * @param {Object} [options={}] &#x989D;&#x5916;&#x7684;&#x53C2;&#x6570;
 * @param {string} [options.units=&apos;kilometers&apos;] &#x5355;&#x4F4D;
 * @returns {Feature&lt;LineString&gt;} &#x7ED3;&#x679C;&#x6298;&#x7EBF;&#x6BB5;AB
 */</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">lineSliceAlong</span>(<span class="hljs-params">line, startDist, stopDist, options</span>) </span>{
    <span class="hljs-comment">// &#x53C2;&#x6570;&#x5224;&#x65AD;</span>
    options = options || {};
    <span class="hljs-keyword">if</span> (!isObject(options)) <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Error</span>(<span class="hljs-string">&apos;options is invalid&apos;</span>);

    <span class="hljs-keyword">var</span> coords;     <span class="hljs-comment">// &#x7EBF;&#x6BB5;L&#x5750;&#x6807;</span>
    <span class="hljs-keyword">var</span> slice = []; <span class="hljs-comment">// &#x7ED3;&#x679C;&#x6570;&#x7EC4;</span>

    <span class="hljs-comment">// &#x9A8C;&#x8BC1;</span>
    <span class="hljs-keyword">if</span> (line.type === <span class="hljs-string">&apos;Feature&apos;</span>) coords = line.geometry.coordinates;
    <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (line.type === <span class="hljs-string">&apos;LineString&apos;</span>) coords = line.coordinates;
    <span class="hljs-keyword">else</span> <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Error</span>(<span class="hljs-string">&apos;input must be a LineString Feature or Geometry&apos;</span>);
    <span class="hljs-keyword">var</span> origCoordsLength = coords.length
    <span class="hljs-keyword">var</span> travelled = <span class="hljs-number">0</span>;
    <span class="hljs-keyword">var</span> overshot, direction, interpolated;

    <span class="hljs-comment">// &#x904D;&#x5386;&#x6298;&#x7EBF;L&#x7684;&#x6570;&#x7EC4;&#xFF0C;&#x5224;&#x65AD;&#x904D;&#x5386;&#x7684;&#x8DDD;&#x79BB;</span>
    <span class="hljs-keyword">for</span> (<span class="hljs-keyword">var</span> i = <span class="hljs-number">0</span>; i &lt; coords.length; i++) {
        <span class="hljs-keyword">if</span> (startDist &gt;= travelled &amp;&amp; i === coords.length - <span class="hljs-number">1</span>) <span class="hljs-keyword">break</span>;
        <span class="hljs-comment">// &#x7ED3;&#x679C;&#x6570;&#x7EC4;&#x6DFB;&#x52A0;&#x7B2C;&#x4E00;&#x4E2A;&#x5750;&#x6807;&#xFF0C;&#x904D;&#x5386;&#x7684;&#x957F;&#x5EA6;&#x8D85;&#x51FA;&#x5F00;&#x59CB;&#x8DDD;&#x79BB;L1&#xFF0C;&#x6298;&#x8FD4;&#x83B7;&#x53D6;&#x7B2C;&#x4E00;&#x4E2A;&#x5750;&#x6807;</span>
        <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (travelled &gt; startDist &amp;&amp; slice.length === <span class="hljs-number">0</span>) {
            overshot = startDist - travelled;
            direction = bearing(coords[i], coords[i - <span class="hljs-number">1</span>]) - <span class="hljs-number">180</span>;
            interpolated = destination(coords[i], overshot, direction, options);
            slice.push(interpolated.geometry.coordinates);
        }

        <span class="hljs-comment">// &#x7ED3;&#x679C;&#x6570;&#x7EC4;&#x6DFB;&#x52A0;&#x6700;&#x540E;&#x4E00;&#x4E2A;&#x5750;&#x6807;&#xFF0C;&#x904D;&#x5386;&#x7684;&#x957F;&#x5EA6;&#x8D85;&#x51FA;&#x7ED3;&#x675F;&#x8DDD;&#x79BB;L2&#xFF0C;&#x6298;&#x8FD4;&#x83B7;&#x53D6;&#x7B2C;&#x4E00;&#x4E2A;&#x5750;&#x6807;</span>
        <span class="hljs-keyword">if</span> (travelled &gt;= stopDist) {
            overshot = stopDist - travelled;
            direction = bearing(coords[i], coords[i - <span class="hljs-number">1</span>]) - <span class="hljs-number">180</span>;
            interpolated = destination(coords[i], overshot, direction, options);
            slice.push(interpolated.geometry.coordinates);
            <span class="hljs-keyword">return</span> lineString(slice);
        }

        <span class="hljs-keyword">if</span> (travelled &gt;= startDist) {
            slice.push(coords[i]);
        }

        <span class="hljs-keyword">if</span> (i === coords.length - <span class="hljs-number">1</span>) {
            <span class="hljs-keyword">return</span> lineString(slice);
        }

        <span class="hljs-comment">// &#x904D;&#x5386;&#x8DDD;&#x79BB;&#x81EA;&#x589E;</span>
        travelled += distance(coords[i], coords[i + <span class="hljs-number">1</span>], options);
    }

    <span class="hljs-keyword">if</span> (travelled &lt; startDist &amp;&amp; coords.length === origCoordsLength) <span class="hljs-keyword">throw</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Error</span>(<span class="hljs-string">&apos;Start position is beyond line&apos;</span>);
    <span class="hljs-keyword">return</span> lineString(coords[coords.length - <span class="hljs-number">1</span>]);
}
</code></pre>
<h1 id="linesplit">lineSplit</h1>
<blockquote>
<p>&#x4F7F;&#x7528;&#x8981;&#x7D20;F&#x88C1;&#x526A;&#x6298;&#x7EBF;L&#xFF0C;&#x8FD9;&#x91CC;&#x7684;&#x8981;&#x7D20;F&#x53EF;&#x4EE5;&#x662F;&#x70B9;&#x7EBF;&#x9762;&#xFF0C;&#x5982;&#x679C;&#x662F;&#x7EBF;&#x6216;&#x9762;&#x7684;&#x8BDD;&#xFF0C;&#x53EF;&#x4EE5;&#x770B;&#x6210;&#x662F;F&#x4E0E;L&#x7684;&#x4EA4;&#x70B9;&#x88C1;&#x526A;L&#x3002;&#x6240;&#x4EE5;&#x8FD9;&#x91CC;&#x8003;&#x8651;&#x7B80;&#x5355;&#x7684;&#x60C5;&#x51B5;&#xFF0C;&#x6298;&#x7EBF;&#x4E0A;&#x7684;&#x4E00;&#x70B9;P&#x88C1;&#x526A;&#x8FD9;&#x6761;&#x6298;&#x7EBF;L&#x3002;</p>
</blockquote>
<p><strong>&#x601D;&#x8DEF;&#xFF1A;</strong></p>
<ol>
<li><p>&#x6298;&#x7EBF;L&#x6784;&#x5EFA;R&#x6811;&#xFF0C;&#x65B9;&#x4FBF;&#x5927;&#x6570;&#x636E;&#x91CF;&#x7A7A;&#x95F4;&#x67E5;&#x627E;</p>
</li>
<li><p>R&#x6811;&#x67E5;&#x627E;&#x6298;&#x7EBF;L&#x4E2D;&#x4E0E;&#x88C1;&#x526A;&#x70B9;&#x76F8;&#x4EA4;&#x7684;&#x7EBF;&#x6BB5;I</p>
</li>
<li>&#x904D;&#x5386;&#x6298;&#x7EBF;L&#x4E2D;&#x7EBF;&#x6BB5;&#xFF0C;&#x6839;&#x636E;&#x7EBF;&#x6BB5;I&#x7684;&#x7F16;&#x53F7;&#x5C06;&#x6298;&#x7EBF;L&#x4E2D;&#x7684;&#x7EBF;&#x6BB5;&#x5206;&#x4E3A;&#x4E24;&#x6BB5;</li>
<li>&#x820D;&#x5F03;&#x7EBF;&#x6BB5;I&#xFF0C;&#x4F7F;&#x7528;&#x88C1;&#x526A;&#x70B9;P&#x5750;&#x6807;&#x8FDE;&#x63A5;</li>
</ol>
<p><strong>&#x5B9E;&#x73B0;&#xFF1A;</strong></p>
<pre><code class="lang-javascript"><span class="hljs-comment">/**
 * Split LineString with Point
 *
 * @private
 * @param {Feature&lt;LineString&gt;} line LineString
 * @param {Feature&lt;Point&gt;} splitter Point
 * @returns {FeatureCollection&lt;LineString&gt;} split LineStrings
 */</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">splitLineWithPoint</span>(<span class="hljs-params">line, splitter</span>) </span>{
    <span class="hljs-keyword">var</span> results = [];

    <span class="hljs-comment">// handle endpoints</span>
    <span class="hljs-keyword">var</span> startPoint = getCoords(line)[<span class="hljs-number">0</span>];
    <span class="hljs-keyword">var</span> endPoint = getCoords(line)[line.geometry.coordinates.length - <span class="hljs-number">1</span>];
    <span class="hljs-keyword">if</span> (pointsEquals(startPoint, getCoord(splitter)) ||
        pointsEquals(endPoint, getCoord(splitter))) <span class="hljs-keyword">return</span> featureCollection([line]);

    <span class="hljs-comment">// Create spatial index</span>
    <span class="hljs-keyword">var</span> tree = rbush();
    <span class="hljs-keyword">var</span> segments = lineSegment(line);
    tree.load(segments);

    <span class="hljs-comment">// Find all segments that are within bbox of splitter</span>
    <span class="hljs-keyword">var</span> search = tree.search(splitter);

    <span class="hljs-comment">// Return itself if point is not within spatial index</span>
    <span class="hljs-keyword">if</span> (!search.features.length) <span class="hljs-keyword">return</span> featureCollection([line]);

    <span class="hljs-comment">// RBush might return multiple lines - only process the closest line to splitter</span>
    <span class="hljs-keyword">var</span> closestSegment = findClosestFeature(splitter, search);

    <span class="hljs-comment">// Initial value is the first point of the first segments (beginning of line)</span>
    <span class="hljs-keyword">var</span> initialValue = [startPoint];
    <span class="hljs-keyword">var</span> lastCoords = featureReduce(segments, <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">previous, current, index</span>) </span>{
        <span class="hljs-keyword">var</span> currentCoords = getCoords(current)[<span class="hljs-number">1</span>];
        <span class="hljs-keyword">var</span> splitterCoords = getCoord(splitter);

        <span class="hljs-comment">// Location where segment intersects with line</span>
        <span class="hljs-keyword">if</span> (index === closestSegment.id) {
            previous.push(splitterCoords);
            results.push(lineString(previous));
            <span class="hljs-comment">// Don&apos;t duplicate splitter coordinate (Issue #688)</span>
            <span class="hljs-keyword">if</span> (pointsEquals(splitterCoords, currentCoords)) <span class="hljs-keyword">return</span> [splitterCoords];
            <span class="hljs-keyword">return</span> [splitterCoords, currentCoords];

        <span class="hljs-comment">// Keep iterating over coords until finished or intersection is found</span>
        } <span class="hljs-keyword">else</span> {
            previous.push(currentCoords);
            <span class="hljs-keyword">return</span> previous;
        }
    }, initialValue);
    <span class="hljs-comment">// Append last line to final split results</span>
    <span class="hljs-keyword">if</span> (lastCoords.length &gt; <span class="hljs-number">1</span>) {
        results.push(lineString(lastCoords));
    }
    <span class="hljs-keyword">return</span> featureCollection(results);
}
</code></pre>
<h1 id="mask">mask</h1>
<blockquote>
<p>&#x8FD4;&#x56DE;&#x5E26;&#x6709;&#x5185;&#x73AF;&#x7684;&#x591A;&#x8FB9;&#x5F62;</p>
</blockquote>
<h1 id="nearestpointonline">nearestPointOnLine</h1>
<blockquote>
<p>&#x83B7;&#x53D6;&#x6298;&#x7EBF;L&#x4E0A;&#x8DDD;&#x70B9;P&#x6700;&#x8FD1;&#x7684;&#x70B9;&#x5750;&#x6807;</p>
</blockquote>
<p><strong>&#x601D;&#x8DEF;&#xFF1A;</strong> </p>
<ol>
<li>&#x70B9;P&#x5728;&#x6298;&#x7EBF;L&#x4E0A;&#x65F6;&#xFF0C;P&#x70B9;&#x5750;&#x6807;&#x5373;&#x6240;&#x6C42;&#x5750;&#x6807;</li>
<li>&#x70B9;P&#x5728;&#x6298;&#x7EBF;L&#x5916;&#x662F;&#xFF0C;&#x6240;&#x6C42;&#x70B9;&#x7684;&#x5750;&#x6807;&#x6709;&#x4E24;&#x79CD;&#x60C5;&#x51B5;&#xFF1A;1&#xFF09;&#x8BE5;&#x70B9;&#x662F;&#x6298;&#x7EBF;L&#x7684;&#x4E00;&#x4E2A;&#x7AEF;&#x70B9; 2&#xFF09;&#x8BE5;&#x70B9;&#x5728;&#x6298;&#x7EBF;L&#x67D0;&#x6761;&#x7EBF;&#x6BB5;&#x4E0A;(&#x5782;&#x8DB3;)</li>
</ol>
<p><strong>&#x5B9E;&#x73B0;:</strong></p>
<pre><code class="lang-javascript">      <span class="hljs-comment">/* &#x8BA1;&#x7B97;&#x5782;&#x8DB3;&#x7684;&#x5750;&#x6807;*/</span>

&#x200B;      <span class="hljs-keyword">const</span> start = point(coords[i]);  <span class="hljs-comment">// &#x7EBF;&#x6BB5;&#x8D77;&#x70B9;</span>

&#x200B;      start.properties.dist = distance(pt, start, options); <span class="hljs-comment">// pt&#x662F;&#x70B9;P</span>

&#x200B;      <span class="hljs-keyword">const</span> stop = point(coords[i + <span class="hljs-number">1</span>]); <span class="hljs-comment">// &#x7EBF;&#x6BB5;&#x7EC8;&#x70B9;</span>

&#x200B;      stop.properties.dist = distance(pt, stop, options);

&#x200B;      <span class="hljs-keyword">const</span> sectionLength = distance(start, stop, options); <span class="hljs-comment">// &#x7EBF;&#x6BB5;&#x957F;&#x5EA6;</span>

&#x200B;      <span class="hljs-keyword">const</span> heightDistance = <span class="hljs-built_in">Math</span>.max(start.properties.dist, stop.properties.dist);

&#x200B;      <span class="hljs-keyword">const</span> direction = bearing(start, stop);  <span class="hljs-comment">// &#x8BA1;&#x7B97;&#x7EBF;&#x6BB5;&#x65B9;&#x4F4D;</span>

&#x200B;      <span class="hljs-comment">// &#x83B7;&#x53D6;&#x70B9;P&#x4E0E;&#x7EBF;&#x6BB5;&#x7684;&#x4E24;&#x6761;&#x5782;&#x7EBF;&#xFF0C;heightDistance&#x91C7;&#x7528;&#x8F83;&#x957F;&#x8DDD;&#x79BB;&#x662F;&#x786E;&#x4FDD;&#x5782;&#x7EBF;&#x4E00;&#x5B9A;&#x4F1A;&#x4E0E;&#x7EBF;&#x6BB5;&#x76F8;&#x4EA4;</span>

&#x200B;      <span class="hljs-keyword">const</span> perpendicularPt1 = destination(pt, heightDistance, direction + <span class="hljs-number">90</span>, options); 

&#x200B;      <span class="hljs-keyword">const</span> perpendicularPt2 = destination(pt, heightDistance, direction - <span class="hljs-number">90</span>, options);

&#x200B;      <span class="hljs-comment">// &#x83B7;&#x53D6;&#x5782;&#x8DB3;</span>

&#x200B;      <span class="hljs-keyword">const</span> intersect = lineIntersects(

    &#x200B;        lineString([perpendicularPt1.geometry.coordinates, perpendicularPt2.geometry.coordinates]),

    &#x200B;        lineString([start.geometry.coordinates, stop.geometry.coordinates])

&#x200B;      );
</code></pre>
<h1 id="shortestpath">shortestPath</h1>
<p>A*&#x7B97;&#x6CD5;&#xFF0C; &#x56FE;&#x8BBA;</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="chapter4.html" class="navigation navigation-prev " aria-label="Previous page: 4、FEATURE CONVERSION">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="chapter6.html" class="navigation navigation-next " aria-label="Next page: 6、HELPER">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"5、MISC","level":"1.6","depth":1,"next":{"title":"6、HELPER","level":"1.7","depth":1,"path":"Chapter/chapter6.md","ref":"Chapter/chapter6.md","articles":[]},"previous":{"title":"4、FEATURE CONVERSION","level":"1.5","depth":1,"path":"Chapter/chapter4.md","ref":"Chapter/chapter4.md","articles":[]},"dir":"ltr"},"config":{"plugins":["sharing","livereload"],"styles":{"website":"./styles/website.css"},"pluginsConfig":{"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["weibo","google","twitter","weibo","instapaper"]},"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"lijian","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"turf源码算法分析","language":"zh-hans","gitbook":"3.2.3","description":"turf源码算法分析"},"file":{"path":"Chapter/chapter5.md","mtime":"2021-03-06T09:21:51.502Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-03-28T04:08:06.675Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

